package cn.hnu.jpa.jpaExample.SuperManyToOneOneToMany;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
public class SuperAddress implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Integer id;
	
	private String addr;
	
	private SuperCustomer customer;

	@Id @GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getAddr() {
		return addr;
	}

	public void setAddr(String addr) {
		this.addr = addr;
	}


	@ManyToOne//(cascade = {CascadeType.ALL})  //可以加上 这样双向可以保存
	@JoinColumn(name="cus_id")
	public SuperCustomer getCustomer() {
		return customer;
	}

	public void setCustomer(SuperCustomer customer) {
		this.customer = customer;
	}
	
	

}
